'use strict';

var 
    fs = require('fs'),
    url = require('url'),
    path = require('path'),
    http = require('http');

    // 获取当前目录
    var root = path.resolve(process.argv[2] || '.');
    console.log(`root: ${root}`);
    var server;

    server = http.createServer((request, response) => {
        // 获得请求路径
        var pathname = url.parce(request.url).pathname
        // 获得文件对应的路径
        var filePath = path.join(root, pathname);
        fs.stat(filePath, (err, stat) => {
            if (err) {

            } else {
                
            }
        })
    })
    